package me.zhengjie.modules.serviceprovider.repository;

import me.zhengjie.modules.serviceprovider.domain.TServiceproviderManager;
import me.zhengjie.modules.serviceprovider.domain.TServiceproviderPerson;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Optional;

/**
* @author xuyukun
* @date 2019-07-20
*/


public interface TServiceproviderPersonRepository extends JpaRepository<TServiceproviderPerson, Long>, JpaSpecificationExecutor {
    //List<TServiceproviderPerson> findByPersonNameAndIsDelete(String username,Integer isDelete);

    List<TServiceproviderPerson> findByAccountAndIsDelete(String account,Integer isDelete);
    List<TServiceproviderPerson> findByPhoneAndIsDelete(String phone,Integer isDelete);
    //List<TServiceproviderPerson> findByAccountList(String account);


    @Modifying
    @Query(value="update t_serviceprovider_person set serviceprovider_name=:supplier_name where serviceprovider_id=:supplier",nativeQuery = true)
    public Integer updateSupplierName(@Param("supplier") Long supplier, @Param("supplier_name") String supplier_name);
}